<template>
  <view class="search" :style="`background-color: ${bgcolor};`" @click="goToSearch">
    <view class="my-search-box" :style="`border-radius: ${radius}px`">
      <uni-icons type="search" size="17"></uni-icons>
      <text class="text">搜索</text>
    </view>
  </view>
</template>

<script setup>
  const emits = defineEmits(["click"]);
  const props = defineProps({
    // 背景颜色
    bgcolor: {
      type: String,
      default: '#2faf63'
    },
    radius: {
      type: Number,
      default: 18
    }
  });
  function goToSearch() {
    emits('click')
  }
</script>

<style lang="scss" scoped>
  .search {
    height: 50px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    .my-search-box {
      height: 36px;
      background-color: #fff;
      width: 100%;
      line-height: 36px;
      text-align: center;
      .text {
        font-size: 15px;
        margin-left: 5px;
      }
    }
  }
</style>